﻿using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.Metadata.FormElement;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RK.SerivesPlugin.XHX
{
    [Description("服务插件报关单:保存转换唛头换行"), HotUpdate]
    public class BgSaveConvertMarks : AbstractOperationServicePlugIn
    {
        public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
        {
            base.BeforeExecuteOperationTransaction(e);
            if (this.FormOperation.OperationId == FormOperation.Operation_Save)
            {
                foreach (var order in e.DataEntitys)
                {
                    string marks = order["F_MARKS"].ToString();
                    string F_MARKS = "";
                    string[] mark = marks.Split(',');
                    for (int i = 0; i < mark.Length; i++)
                    {
                        if (i == 0)
                        {
                            F_MARKS = mark[0];
                        }
                        else
                        {
                            F_MARKS = F_MARKS + Environment.NewLine + mark[i];
                        }
                    }
                    order["F_MARKS"] = F_MARKS;
                }
            }
        }
    }
}
